Lab 5, Spring 2023

Using an editor, answer the following questions:

NAME:
Palak Trivedi
---------
example.c
---------
1) What is the cause of the seg fault in the program called example.c?

The line "sum += data[i];" is the cause of the seg fault.

--------
broken.c
--------
2) What line in broken.c did the program seg fault on?

	Line 27: "if(table[i++] == 11" was the location of the seg fault.

3) What was the value of the variable "count" at the time of the seg fault?

	10

4) What was the value of the variable "i" at the time of the seg fault?

	9

5) What was the value of the variable "search" at the time of the seg fault?

	1

6) What are the values in the "table" array?

	{5, 10, 12, 14, 16, 18, 20, 22, 24, 26}

7) what do you think the bug is?

	The bug happens when the array attempts to access table 10 because the array is of size 10, meaning we can't access a table beyond table 9, causing the seg fault.
